import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;


public class youtube {
	FirefoxDriver driver;
	String baseUrl;
	//This is a test
	
	@Before
	public void setUp() throws Exception{
		driver = new FirefoxDriver();
		baseUrl = "http://youtube.com";
		
	}
	
	
	@Test
	public void search() throws Exception {
		String iSearch; String oSearch; 
		int iwait;
		iwait = 3000;
		
		iSearch = "QTP";
		//oSearch = "About 61,700 results";
		
		driver.get(baseUrl + "/");
		driver.findElement(By.xpath("//input[@id ='masthead-search-term']")).sendKeys(iSearch);
		Thread.sleep(iwait);
		driver.findElement(By.xpath("//button[@id = 'search-btn']")).click();
		
		oSearch = driver.findElement(By.xpath("/html/body/div/div[3]/div/div[5]/div/div/div/div/div/div[2]/div/div/div/p/strong")).getText();
		System.out.println("Output Result is " + oSearch);
	}

	@ After
	public void tearDown() throws Exception{
		
	}
}
